package com.kantboot.business.gc.domain.vo;

import com.kantboot.business.gc.domain.entity.BusGcGameI18n;
import com.kantboot.business.gc.domain.entity.BusGcType;
import com.kantboot.util.core.jpa.KantbootGenerationType;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Entity
@Getter
@Setter
@Table(name = "bus_gc_game")
@Accessors(chain = true)
@EntityListeners(AuditingEntityListener.class)
@DynamicUpdate
@DynamicInsert
public class BusGcGameVO implements Serializable {

    /**
     * 主键
     */
    @Id
    @GenericGenerator(name = "snowflakeId",strategy = KantbootGenerationType.SNOWFLAKE)
    @GeneratedValue(generator = "snowflakeId")
    @Column(name = "id")
    private Long id;

    @OneToMany
    @JoinColumn(name = "game_id")
    private List<BusGcGameI18n> i18nList;

    /**
     * 中文名称
     */
    @Column(name = "zh_name")
    private String zhName;

    /**
     * 英文名称
     */
    @Column(name="en_name")
    private String enName;

    /**
     * 中文描述
     */
    @Column(name = "zh_description")
    private String zhDescription;

    /**
     * 英文描述
     */
    @Column(name = "en_description")
    private String enDescription;

    /**
     * 点击次数
     * 默认为0
     */
    @Column(name = "click_count")
    private Long clickCount = 0L;

    /**
     * 图片id
     */
    @Column(name = "file_id_of_image")
    private Long fileIdOfImage;

    /**
     * 链接
     */
    @Column(name = "t_link")
    private String link;

    /**
     * 创建时间
     */
    @CreatedDate
    @Column(name = "gmt_create")
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @LastModifiedDate
    @Column(name = "gmt_modified")
    private Date gmtModified;

    /**
     * 优先级
     */
    @Column(name = "t_priority")
    private Integer priority;

    @ManyToMany
    @JoinTable(name = "bus_gc_game_type",
            joinColumns = @JoinColumn(name = "game_id"),
            inverseJoinColumns = @JoinColumn(name = "type_id"))
    private List<BusGcType> types;

}
